<?php

/*
 * Copyright (C) 2014 abc
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Description of GetPost
 *
 * @author abc
 */

namespace system;

final class getpost {

//    private $post = array();
//    public function __construct($args) {
//        $post = array();
//        $post = filter_input_array(INPUT_POST, $args);
//        $this->post = $post;
//    }
//    public static function get($key) {
//        if (array_key_exists($key, $this->post)) : return $this->post[$key];
//        else : return FALSE;
//        endif;
//    }

    public static function get($args, $array = true) {
        $post = array();
        if ($array === true) :
            unset($post);
            $post = filter_input_array(INPUT_POST, $args);
            return $post;
        else:
            unset($post);
            $post = filter_input(INPUT_POST, $array, $args);
            return $post;
        endif;
    }

    public static function gettest() {
        $post = array();
        unset($post);
        $post = filter_input_array(INPUT_POST);
        return $post;
    }

}
